package com.cskaoyan.controller.backStage;

import com.cskaoyan.model.vo.BaseRespVO;
import com.cskaoyan.model.vo.ChartVO;
import com.cskaoyan.model.vo.OrderChartVO;
import com.cskaoyan.service.StatService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
// 不授权
/**
 * @program: mall38
 * @description: 统计报表
 * @author: Lexis
 * @create: 2022-05-06 19:00
 **/
@RestController
@RequestMapping("admin/stat")
public class StatController {

    @Autowired
    StatService statService;

    @GetMapping("user")
    /**
     * @author: lixiaosheng
     * @description: 返回用户统计报表的数据
     * @date: 2022/5/6 19:12
     */
    public BaseRespVO<ChartVO> showUser() {
        ChartVO chartVO = statService.getGrowingUsers();
        return BaseRespVO.ok(chartVO);
    }

    @GetMapping("goods")
    /**
     * @author: lixiaosheng
     * @description: 返回商品统计报表的数据
     * @date: 2022/5/6 19:46
     */
    public BaseRespVO<ChartVO> showOrderGoods() {
        ChartVO chartVO = statService.getOrderGoods();
        return BaseRespVO.ok(chartVO);
    }

    @GetMapping("order")
    /**
     * @author: lixiaosheng
     * @description: 返回订单报表数据
     * @date: 2022/5/6 20:44
     */
    public BaseRespVO<ChartVO> showOrder() {
        ChartVO<OrderChartVO> chartVO = statService.getOrder();
        return BaseRespVO.ok(chartVO);
    }
}
